import Vue from 'vue'
import axios from 'axios'
import App from './App'
import router from './router'
import store from './store'

if (!process.env.IS_WEB) Vue.use(require('vue-electron'));
Vue.http = Vue.prototype.$http = axios;
Vue.config.productionTip = false;

/* ElementUI */
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI);

/* App自定义 */
import Global from './Global.js'
Vue.prototype.Global = Global;

/* YFree */
import yFree from './YFree/YFree.js'
yFree.yInit(yConfig => {
    yConfig.webName = "YFree_Electron";
    yConfig.onYHTTPHeader = () => {
        let time = new Date().getTime().toString();
        let userModel = yFree.yRead(Global.IFinal.SaveKey.userModel);
        return {
            'sign-device': "PC",
            'sign-version': "100",
            'sign-rst': time,
            'sign-uid': yFree.yIsEmpty(userModel) ? '' : userModel.uid,
            'sign-password': yFree.yIsEmpty(userModel) ? '' : userModel.sign_password,
            'sign-sign': yFree.yIsEmpty(userModel) ? '' : yFree.yMD5(yFree.yMD5(userModel.sign_token) + time)
        }
    };
});

/* eslint-disable no-new */
new Vue({
    components: {App},
    router,
    store,
    template: '<App/>'
}).$mount('#app');
